<script type="text/javascript">
	jQuery(document).ready(function(){
		jQuery("#qna-form").validationEngine();
	});

	var err		=	'<?php echo $error?>';
	var inform	=	'<?php echo $inform?>';
	if(err == 'true'){
		alert('Please type valid verification number.');
	}
	if(inform == 'true'){
		alert('Submit successfully! Thanks for sending us a question.');
	}
</script>
<div id="inner">
        <div class="wrap">
            <div id="main">
                <div id="content" class="questions entry">
                    <h1 class="entry-title">Questions & Answers</h1>

                    <div id="question-serch" class="clearfix">
                        <form class="search-question" action="<?php echo base_url();?>search" method="post">
                            <input type="text" name="question" class="s" value="Search your question..." onfocus="if (this.value == 'Search your question...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search your question...';}" />
                            <input type="submit" class="s-submit submit" value="Search">
                        </form>

                        <span>or</span>
                        <a href="#make-question" class="make-question submit">Ask your question</a>
                    </div><!-- end #question-search -->

                    <div class="question entry-content">
                    	<?php if(count($questions_list[0])>0){?>
                    		<?php foreach ($questions_list as $k => $v){?>
		                        <h3>
		                            <span>Question: </span>
		                            <a href="<?php echo base_url().'answer/'.ascii_link($v->brief);?>"><?php echo $v->brief;?></a>
		                        </h3>
		                        <p><?php echo $v->detail;?></p>
		                        <p style="color:#888;">Asked by <span style="color: green; font-weight: bold;"><?php echo $v->sender;?></span>, <?php echo get_num_time($v->time)?></p>
		                        <p class="answer-link"><a href="<?php echo base_url().'answer/'.ascii_link($v->brief);?>" class="more-link">Answer</a></p>
	                        <?php }?>
                        <?php }else {echo "<span style='color:green; font-style:italic; font-size:16px'>Sorry! There is no question at this moment.</span>";}?>
                        <div class="pagination"><?php if(isset($pagination)){echo $pagination;}?></div>
                    </div><!-- end .question -->

                    <div id="make-question">
                   		<a name="make-question"></a>
                        <p class="your-question">Your question</p>
                        <form class="ask-question-form" action="<?php echo base_url();?>submit-question" method="post" id="qna-form">
                        	<div class="qna" >
                        		<div class="qna-name">
	                        		<label for="info_name">Your name*</label><br>
	                        		<input type="text" class="validate[required]" name="info_name" value="<?php echo set_value('info_name');?>" id="info-name" />
                        		</div>
                        		<div class="qna-email">
	                        		<label for="info_email">Your email*</label>
	                        		<span class="tooltip" title="Your email will not be displayed "><img src="<?php echo img_link('icon_help.png', 'client');?>" title="" alt="" class="" id="email_display" /></span>
	                        		<br>
	                        		<input type="text" class="validate[required, custom[email]]" name="info_email" value="<?php echo set_value('info_email');?>" id="info-email" />
                        		</div>
                        	</div>
                            <div class="qna-brief">
                                <label for="question">A brief of your question</label><br/>
                                <input type="text" name="brief" id="question" value="<?php echo set_value('brief');?>"/>
                            </div>

                            <div class="qna-detail">
                                <label for="question_detail">Your question details*</label><br/>
                                <textarea name="question_detail" id="question_detail" value="" class="validate[required]"><?php echo set_value('question_detail');?></textarea>
                            </div>
                            <div class="qna-captcha">
                            	<label for="captcha">Verification Number* ( <font color='green'><?php echo $verify;?> </font>)</label><br>
                            	<input type="text" name="verification_num" id="verification_number" value="" />
                            </div>
                            <div>
                                <input type="submit" class="submit-question submit" value="Submit your question" />
                            </div>
                        </form>
                    </div>
                </div><!-- end #content -->
            </div><!-- end #main -->